package com.siyuanren.gcocp.enums.wx;

import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
 * 毕业要求
 * @author PVer
 */
public enum CourseGradEnum {
    COURSE_GRADE("训练毕业", 1, 60),
    COURSE_GRADE_FINE("优秀学员", 2, 80);

    private String desc;
    private int value;
    private int score; // 在课程结束后，如若学员学分达到课程总学分60%即可认证毕业，若达到80%将会被评为优秀学员

    CourseGradEnum(String desc, int value, int score) {
        this.desc = desc;
        this.value = value;
        this.score = score;
    }

    public static CourseGradEnum getModel(int value) {
        for (CourseGradEnum he : CourseGradEnum.values()) {
            if (Objects.equals(value, he.getValue())) {
                return he;
            }
        }
        return null;
    }

    public static String getEnumDesc(Integer value) {
        if (value == null) {
            return StringUtils.EMPTY;
        }
        CourseGradEnum model = getModel(value);
        if (model == null) {
            return StringUtils.EMPTY;
        }
        return model.getDesc();
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }
}